package com.sky.mapper;

import com.sky.annotation.aop.AutoFill;
import com.sky.dto.EmployeePageQueryDTO;
import com.sky.entity.Employee;
import com.sky.enumeration.OperationType;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface EmployeeMapper {

    /**
     * 根据用户名查询员工
     * @param username
     * @return Employee
     */
    Employee getByUsername(@Param("username") String username);

    /**
     * 新增员工
     * @param employee
     */
    @AutoFill(OperationType.INSERT)
    void addEmployee(Employee employee);

    /**
     * 分页查询员工
     * @return List<Employee>
     */
    List<Employee> pageEmployee(EmployeePageQueryDTO employeePageQueryDTO);

    /**
     * 更新员工信息
     * @param employee
     */
    @AutoFill(OperationType.UPDATE)
    void update(Employee employee);

    /**
     * 根据ID查询员工
     * @param id
     * @return
     */
    Employee getById(@Param("id") Long id);
}
